const mongoose = require('mongoose');
const { ObjectId } = mongoose.Schema;

/**
 * Export model definition object.
 */
module.exports = {
  projectId: ObjectId,
  versionId: { type: ObjectId, index: true },
  fileId: { type: ObjectId, index: true },
  functionId: { type: ObjectId, index: true },
  type: Number,
  manual: Boolean,
  description: String,
  locations: [
    {
      _id: false,
      begin: {
        line: Number,
        column: Number,
      },
      end: {
        line: Number,
        column: Number,
      },
      type: {
        type: String,
      },
    },
  ],
  testcases: [
    {
      _id: false,
      id: String,
      number: Number,
    },
  ],
  unread: { type: Boolean, default: true },
};
